Skip to content

Comments

feat(openviking-plugin): native Session+Search integration with memory-first retrieval and observable fallback#2

Open
mczabca-boop wants to merge 6 commits intosteven1522:feature/plugin-systemfrom
mczabca-boop:feat/openviking-on-pr1-base
Open

feat(openviking-plugin): native Session+Search integration with memory-first retrieval and observable fallback#2
mczabca-boop wants to merge 6 commits intosteven1522:feature/plugin-systemfrom
mczabca-boop:feat/openviking-on-pr1-base

Conversation

@mczabca-boop
Copy link

@mczabca-boop mczabca-boop commented Feb 24, 2026

Summary
This PR continues the OpenViking direction from TinyAGI#127 and remains stacked on #1 and #2 lineage (TinyAGI#127 -> #1 -> #2).

It integrates TinyClaw with OpenViking native Session + Search flow while preserving legacy markdown fallback, and pluginizes OpenViking context handling so core queue processing is no longer OpenViking-hardcoded.

What this PR adds

  1. OpenViking context is now truly pluginized
    OpenViking context/session/search/writeback logic is moved behind the TinyClaw plugin system.
    Core queue-processor now calls generic plugin lifecycle hooks:
    onSessionReset
    beforeModel
    afterModel
    onSessionEnd
    plus onStartup / onHealth
    When OpenViking plugin is disabled, TinyClaw runs normally without OpenViking calls.
  2. Native OpenViking session lifecycle as primary write path
    Create/reuse session via stable mapping:
    (channel, senderId, agentId) -> openviking_session_id
    Write user/assistant messages to native session.
    Commit on reset.
    Keep fallback writeback path explicit and observable.
  3. Native OpenViking search as primary prefetch path
    Prefer typed retrieval from memory/resource/skill.
    Memory-first composition for injected context.
    Structured short snippets for prompt injection (instead of large raw turn blocks).
  4. Compatibility fallback retained
    Legacy markdown path (active.md / *.md) is still supported.
    Fallback reasons are explicitly logged.
    Legacy path is managed inside plugin logic (not core flow branches).
  5. Better observability
    Native session write/commit success/failure logs.
    Retrieval hit distribution logging (memory/resource/skill).
    Explicit fallback reason + diagnostics logging.
    Native prefetch dump for debugging:
    prefetch_dump_native_latest.txt
  6. Setup/runtime compatibility preserved
    Existing OpenViking feature flags remain compatible.
    Existing user-visible context injection format is preserved.
    Telegram/WhatsApp/Discord message pipeline behavior remains unchanged.
    Key files touched
    queue-processor.ts
    plugins.ts
    index.ts
    prefetch.ts
    session-map.ts
    openviking-prefetch.ts (compat re-export)
    openviking-session-map.ts (compat re-export)
    types.ts
    test-openviking-context-plugin.js
    openviking-tool.ts
    openviking-tool.js
    setup-wizard.sh
    daemon.sh
    Compatibility / rollback
    Feature flags (compatible with existing behavior):

TINYCLAW_OPENVIKING_CONTEXT_PLUGIN=0 (disable OpenViking context plugin entirely)
TINYCLAW_OPENVIKING_SESSION_NATIVE=1
TINYCLAW_OPENVIKING_SEARCH_NATIVE=1
TINYCLAW_OPENVIKING_PREFETCH=1
TINYCLAW_OPENVIKING_AUTOSYNC=1
If native/plugin flags are disabled, behavior falls back to non-OpenViking / legacy-compatible path.

Validation notes
Build passes:
npm run build:main
Regression passes:
npm run test:prefetch-parser
New pluginization integration tests pass:
npm run test:openviking-plugin
covers:
plugin disabled: no OpenViking calls
plugin enabled: native session + search + context injection
plugin failure: fallback path still works and is observable
Risk / follow-up
OpenViking latency (prefetch/commit) is environment-sensitive; timeout tuning may still be needed.
With stacked PR merge progression, diff should further collapse to OpenViking incremental changes only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant